# Euler Problem 1
# Add all the natural numbers below one thousand that are multiples of 3 or 5.

#################################
cycles = 100000
cycles = 1
import time
c1 = time.clock()
for x in xrange(0xFFFFF): pass
for i in range(cycles):
#################################
### program calculation start ###
#################################

    sum = 0

### Initial program, takes 0.32 ms    
#   number = 3
#   while number < 1000:
#       sum += number
#       number += 3
#   number = 5
#   while number < 1000:    
#       sum += number
#       number += 5
#   number = 15
#   while number < 1000:
#       sum -= number
#       number += 15

### Final refined program, takes 0.20 ms
    for number in range(3,1000,3):
        sum += number
    for number in range(5,1000,5):
        sum += number
    for number in range(15,1000,15):
        sum -= number

### Code lifted from post #27, takes 0.65 ms
#    for i in range(1,1000):
#        if i % 3 == 0 or i % 5 == 0:
#            sum = sum + i

answer = sum
#################################
###  program calculation end  ###
#################################
c2 = time.clock()
if cycles > 1: print "Time spent is %.2f ms" % ((c2-c1)*1000/cycles)
#################################
        
print 'The answer to Problem #1 is >>', answer, '<<'

        